<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link href="../css/mui.picker.css" rel="stylesheet" />
		<link href="../css/mui.poppicker.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/tab-goods-type.css" />
		<style>
		
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">宝贝分类</h1>
		</header>
		<div class="mui-content mui-row mui-fullscreen">
			<div class="mui-col-xs-3">
				<div id="segmentedControls" class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical">
				<a class="mui-control-item" onclick="get_goods_list('手机数码')">手机数码</a>
				<a class="mui-control-item" onclick="get_goods_list('女装')">女装</a>
				<a class="mui-control-item" onclick="get_goods_list('男装服饰')">男装服饰</a>
				<a class="mui-control-item" onclick="get_goods_list('电器')">电器</a>
				<a class="mui-control-item" onclick="get_goods_list('书刊')">书刊</a>
				<a class="mui-control-item" onclick="get_goods_list('其他')">其他</a>
				</div>
			</div>
			<div id="segmentedControlContents" class="mui-col-xs-9" style="border-left: 1px solid #c8c7cc;">
				<div id="content" class="mui-control-content">
					<div class="latest_list" id="goods_list">
						<div class="info" v-for="goods in list" @click="open_detail(goods.id)">
				
							<div class="middle">
								<img :src="goodsImgPath+goods.pictureArray[0]" />
							</div>
							<div class="bottom">
								<span class="price">&yen;{{goods.price}}</span>
								{{goods.des}}
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/vue.min.js" ></script>
		<script type="text/javascript" src="../js/const.js" ></script>
		<script type="text/javascript" src="../js/request.js" ></script>
		<script type="text/javascript" src="../js/goods_service.js" ></script>
		<script>
			mui.init({});
			var goods_list = new Vue({
				el: '#goods_list',
				data: {
					list: [],
					goodsImgPath: GOODS_IMG_PATH + '/',
					userFacePath: USER_FACE_PATH + '/'
				},
				methods: {
					//打开详情页面
					open_detail: function(id) {
						//触发详情页面的自定义事件
						mui.fire(detailPage, 'goodsId', {
							id: id
						});
						detailPage.show('slide-in-right');
					}
				}
			});
			
			mui.plusReady(function() {
					

					//给detailPage赋值,根据ID获取详情页面
					detailPage = plus.webview.getWebviewById('goods-detail');
					if(!detailPage) {
						detailPage = mui.preload({
							id: 'goods-detail',
							url: 'html/goods_detail.html'
						});
					}
				});
			function get_goods_list(goodsType){
				var res = goodsService.get_goods_list_by_goods_type(goodsType);
				goods_list.list = res.data;
			}

		</script>

	</body>

</html>